﻿Public Class frmStatus
    Public Sub New()
        ' この呼び出しは、Windows フォーム デザイナで必要です。
        InitializeComponent()
        ' InitializeComponent() 呼び出しの後で初期化を追加します。
        frmMain.GeneralSettings.ApplyAll(Me)
        frmMain.EditorSettings.ApplyAll(Me)
        frmMain.GridSettings.ApplyAll(Me)
    End Sub

    Public Sub New(ByVal ADataSource As DataTable, ByVal ATitle As String)
        Me.New()
        txtTitle.Text = ATitle
        Grid.DataSource = ADataSource
    End Sub

    Private Sub frmStatus_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Grid.Refresh()
        Me.Width = GetColumnsWidth() + 10 + SystemInformation.HorizontalScrollBarArrowWidth
    End Sub
    Private Function GetColumnsWidth() As Integer
        Dim ret As Integer = 0
        For Each col As DataGridViewColumn In Grid.Columns
            ret += col.Width
        Next
        Return ret
    End Function
    Public Property Title() As String
        Get
            Return txtTitle.Text
        End Get
        Set(ByVal value As String)
            txtTitle.Text = value
        End Set
    End Property

    Public Property DataTable() As DataTable
        Get
            Return Grid.DataSource
        End Get
        Set(ByVal value As DataTable)
            Grid.DataSource = value
        End Set
    End Property
End Class